<?php

	class EbHtmlPage
	{
		var $title;
		var $metaData;
		var $extraHead;
		var $body;
		
		public function __construct($title)
		{
			$this->title = $title;
			$this->metaData = array();
		}
		
		public function addMetaData($name,$content)
		{
			$this->metaData []= (object) array('name' => $name,'content' => $content);
		}
		
		public function htmlHead($value)
		{
			$this->extraHead .= "\n".$value;
		}
		
		private function renderHead()
		{
			echo '<head>';
			echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
			echo '<title>'.$this->title.'</title>';
			
			foreach ($this->metaData AS $meta)
			{
				echo '<meta name="'.$meta->name.'" content="'.$meta->content.'" />';
			}
			
			echo $this->extraHead;
			
			echo '</head>';
		}
		
		private function renderBody()
		{
			echo $this->body;
		}
		
		public function render()
		{
			echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
			echo '<html xmlns="http://www.w3.org/1999/xhtml">';
			
			$this->renderHead();
			
			$this->renderBody();

			echo '</html>'; 
		}
	}